package com.firexxx.study.designmodel.jdkproxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @description: TODO
 * @throws:
 * @author: zhuangzhang2
 * @date: 2020/03/08 19:49
 */
public class ProxyInvocationHandler implements InvocationHandler {

    private Object target;

    public void setTarget(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        MyUtil.method1();

        method.invoke(target, args);

        MyUtil.method2();

        return null;
    }
}